package com.spzx.product.api.factory;

import com.spzx.common.core.domain.R;
import com.spzx.product.api.RemoteBrandService;
import com.spzx.product.api.RemoteCategoryService;
import com.spzx.product.api.domain.vo.BrandVo;
import com.spzx.product.api.domain.vo.CategoryTreeVo;
import com.spzx.product.api.domain.vo.CategoryVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import javax.xml.transform.Source;
import java.util.List;

@Component
@Slf4j
public class RemoteBrandFallbackFactory implements FallbackFactory<RemoteBrandService>
{
    @Override
    public RemoteBrandService create(Throwable cause) {
        log.error("文件服务调用失败:{}", cause.getMessage());
        return new RemoteBrandService() {

            @Override
            public R<List<BrandVo>> getAllBrandList(String source) {
                return R.fail("获取全部品牌失败:{}"+cause.getMessage());
            }
        };
    }
}
